package com.xuecheng.content.config.rabbitmq;

import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;

// @Component
public class RabbitMQConsumer {

    @RabbitListener(bindings = @QueueBinding(
            value = @Queue(value = "test.queue"),
            exchange = @Exchange(value = "test.direct", type = ExchangeTypes.DIRECT),
            key = {"test"}
    ))
    public void publishPage(String msg) {
        System.out.println("消息来啦: " + msg);
    }
}
